package com.zichan360.Spring5WebFlux.controller;

import com.zichan360.domain.CompanyTransform;
import com.zichan360.service.CompanyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

/**
 * 创建用户:杨辽
 * 创建时间: 2018-03-14 12:07
 * 描   述:
 **/
@RestController
@RequestMapping("/company")
public class CompanyController extends DefaultController {

    private CompanyService companyService;

    @Autowired
    public CompanyController(CompanyService companyService) {
        this.companyService = companyService;
    }

    @GetMapping("")
    public Flux<CompanyTransform> list() {
        return this.companyService.list();
    }

    @GetMapping("{id}")
    public Mono<CompanyTransform> getByid(@PathVariable("id") final Integer id) {
        return this.companyService.getById(id);
    }

}
